// packageG/mycomponent/agentShop/agentShop.js
var app = getApp();
Component({

  /**
   * 组件的属性列表
   */
  properties: {
    datas: {
      type: null
    },
    component_id: {
      type: null
    },
  },

  /**
   * 组件的初始数据
   */
  data: {
    infoData: null,
    posterShow: false,
    defaultImg: ""
  },
  lifetimes: {
    attached: function () {
      this.getData();
    }
  },
  /**
   * 组件的方法列表
   */
  methods: {
    async getPoster() {
      let {
        data
      } = await app._postNetWork({
        url: app.getNetAddresss("plugin.agent-shop.frontend.agent.getPoster"),
        data: {
          id: this.data.infoData.id
        }
      })
      if (!data.result) return app.tips(data.msg);
      this.setData({
        posterShow: true,
        defaultImg: data.data.url
      })
    },
    async getData() {
      let {
        data
      } = await app._postNetWork({
        url: app.getNetAddresss("plugin.agent-shop.frontend.agent.index"),
      })
      if (!data.result) return;
      this.setData({
        infoData: data.data
      })
    }
  }
})